package JAVATest;

import java.util.Scanner;

/**
 * ClassName:Text_009
 * Package:JAVATest
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/12-15:29
 * @Version:v1.0
 */
public class Text_009 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入机票原价:");
        int price = sc.nextInt();
        System.out.print("请输入月份:");
        int month = sc.nextInt();
        System.out.print("请输入头等舱 1 经济舱 2:");
        int number=sc.nextInt();
        extracted(number);
        int prices=method(price,month,number);
        System.out.println("一共消费"+prices+"元");
    }

    private static void extracted(int number) {
        if(number ==1){
            System.out.print("您选的是头等舱,");
        }else if(number ==2){
            System.out.print("您选的是经济舱,");
        }
    }
    public static int method(int price, int month, int number){
        if(month>=5&&month<=10){
            if(number==1){
                price= (int) (price * 0.9);
            } else if (number==2) {
                price = (int)(price * 0.85);
            }
        } else if (month>=1&&month<=4||month>=11&&month<=12) {
            if (number==1){
                price= (int) (price * 0.7);
            } else if (number==2) {
                price= (int) (price * 0.65);
            }
        }
        return price;
    }

}
